<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>四则运算</h1>
    <p>
        <span>操作数1:</span>
        <input type="number" id="num1">
    </br>
</br>
        <span>操作数2:</span>
        <input type="number" id="num2">
    </p>
    <p>
        <button onclick="jia()">加</button>
        <button onclick="jian()">减</button>
        <button onclick="cheng()">乘</button>
        <button onclick="chu()">除</button>
    </p>
     <p id="result">
        <span>结果:</span>
        <input type="text" id="result">
    </p>
</body>
</html>
<script>
    function jia() {
      var num1 = parseInt(document.getElementById("num1").value);
      var num2 = parseInt(document.getElementById("num2").value);
      var result = num1 + num2;
      document.getElementById("result").innerHTML = "结果：" + result;
    }

    function jian() {
      var num1 = parseInt(document.getElementById("num1").value);
      var num2 = parseInt(document.getElementById("num2").value);
      var result = num1 - num2;
      document.getElementById("result").innerHTML = "结果：" + result;
    }

    function cheng() {
      var num1 = parseInt(document.getElementById("num1").value);
      var num2 = parseInt(document.getElementById("num2").value);
      var result = num1 * num2;
      document.getElementById("result").innerHTML = "结果：" + result;
    }

    function chu() {
      var num1 = parseInt(document.getElementById("num1").value);
      var num2 = parseInt(document.getElementById("num2").value);
      var result = num1 / num2;
      document.getElementById("result").innerHTML = "结果：" + result;
    }
</script>